package com.mezz.bones.framework.id.generator.repository.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mezz.bones.framework.id.generator.domain.entity.DistributedId;
import com.mezz.bones.framework.id.generator.mapper.IDistributedIdMapper;
import com.mezz.bones.framework.id.generator.repository.IDistributedIdRepository;
import org.springframework.stereotype.Service;

/**
 * @Author: zhuang
 * @Date: 2025/6/6 13:40
 * @Description: TODO
 * @Version: 1.0
 **/

@Service
public class IDistributedIdRepositoryImpl extends ServiceImpl<IDistributedIdMapper, DistributedId> implements IDistributedIdRepository {
    @Override
    public DistributedId findByBusinessKey(String businessKey) {

        LambdaQueryWrapper<DistributedId> q = new LambdaQueryWrapper<>();
        q.eq(DistributedId::getBusinessKey, businessKey);
        return getOne(q);
    }
}
